package com.wpf.test01;

import java.time.Instant;
import java.time.LocalDateTime;

public class demo03 {
    public static void main(String[] args) {
        // 1、创建Instant的对象，获取此刻时间信息
        Instant now = Instant.now(); // 不可变对象

        // 2、获取总秒数
        long second = now.getEpochSecond();
        System.out.println(second);

        // 3、不够1秒的纳秒数
        int nano = now.getNano();
        System.out.println(nano);

        System.out.println(now);

        Instant instant = now.plusNanos(111);

        // Instant对象的作用：做代码的性能分析，或者记录用户的操作时间点
        Instant now1 = Instant.now();
        String name = "";
        for (int i = 0; i < 200000; i++) {
            name += "w";
        }
        Instant now2 = Instant.now();
        System.out.println(now1);
        System.out.println(now2);
        LocalDateTime l = LocalDateTime.now();
    }
}
